import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: () => import('@/views/login'),
    name: 'login',

  },
  {
    path: '/',
    component: () => import('@/views/Layout'),
    // name:'layout',
    children: [
    {
      path:'',
      name:'home',
      component: () => import('@/views/home'),
    },
    {
      path:'/qa',
      name:'qa',
      component: () => import('@/views/qa'),
    },
    {
      path:'/my',
      name:'my',
      component: () => import('@/views/my'),
    },
    {
      path:'/video',
      name:'video',
      component: () => import('@/views/video'),
    },

    ]
  },
  {
    path: '/search',
    component: () => import('@/views/search'),
    name: 'search',
  },
  {
    path: '/article/:articleId',
    component: () => import('@/views/article'),
    name: 'article',
    props:true, //开启props传参，把路由参数映射到组件中 
  },
  {
    path: '/useredit',
    component: () => import('@/views/useredit'),
    name: 'useredit',
 },
]

const router = new VueRouter({
  routes
})

export default router
